package com.hujing.springsource.a04;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import javax.annotation.Resource;

public class Bean1 {
    private final Logger logger = LoggerFactory.getLogger(getClass());
    
    private Bean2 bean2;
    
    @Autowired
    public void setBean2(Bean2 bean2){
        logger.info("@Autowired注解生效:{}",bean2);
        this.bean2 = bean2;
    }
    
    @Autowired
    private Bean3 bean3;
    
    @Resource
    public void setBean3(Bean3 bean3){
        logger.info("@Resource注解生效:{}",bean3);
        this.bean3 = bean3;
    }
    
    private String home;
    
    @Autowired
    public void setHome(@Value("${JAVA_HOME}") String home){
        logger.info("@Value注解生效:{}",home);
        this.home = home;
    }
    
}
